home *** CD-ROM | disk | FTP | other *** search
- global gBitTestData, gBitTestFlag, gKPerSec
-
- on startBitCheck
- set bSize to 10000 + random(100)
- getNetText("http://www.dxm.com/cgi/spew.cgi?" & string(bSize))
- set bandID to getLatestNetID()
- set gBitTestData to [#ID: bandID, #start: the ticks, #size: integer(bSize), #finish: 0]
- set gBitTestFlag to 1
- debug("Checking Your Bandwidth. This will take a few seconds.")
- end
-
- on checkBitstream
- if netDone(getaProp(gBitTestData, #ID)) then
- if netError() = "OK" then
- setaProp(gBitTestData, #finish, the ticks)
- set testTime to getaProp(gBitTestData, #finish) - getaProp(gBitTestData, #start)
- set gKPerSec to float(getaProp(gBitTestData, #size) / 1000) / float(testTime / 60)
- debug(string(gKPerSec))
- set foo to netTextResult(getaProp(gBitTestData, #ID))
- set foo to 0
- if gKPerSec > 10 then
- set bandwidth to 1
- else
- set bandwidth to 0
- end if
- makePref("bandwidth", bandwidth)
- radio(string(bandwidth) & "-band")
- end if
- set gBitTestFlag to 0
- end if
- end
-